import { ConfigManager } from "../../../com/gengine/resource/ConfigManager";
import { StringHelper } from "../../../com/gengine/utils/StringHelper";
//class BubblesConfig
    
    export  class BubblesConfig
    {
        constructor()
        {
            
            this._map = new Map<any, any> /* flash.utils.Dictionary */();
            if (BubblesConfig._instance != null) 
            {
                throw new Error("BubblesConfig 单例");
            }
            this.init();
            return;
        }

        /* internal  */init(): void
        {
            var loc1=ConfigManager.instance.getObjectByFileName("bubbles.xml");
            this.writeConfigs(loc1);
            return;
        }

        /* internal  */writeConfigs(arg1: Object): void
        {
            var loc2=null;
            var loc3=null;
            var loc4=null;
            var loc1=arg1.module as Array<any>;
            var loc5=0;
            var loc6=loc1;
            for(loc2 of loc6) 
            {
                loc4 = StringHelper.getString(loc2.id);
                (loc3 = new Object /* flash.geom.Rectangle */()).x = parseInt(loc2.x);
                loc3.y = parseInt(loc2.y);
                loc3.width = parseInt(loc2.width);
                loc3.height = parseInt(loc2.height);
                this._map[loc4] = loc3;
            }
            return;
        }

        public getRec(arg1: string): Object /* flash.geom.Rectangle */
        {
            var loc1=this._map[arg1] as Object /* flash.geom.Rectangle */;
            if (loc1) 
            {
                return loc1;
            }
            if (arg1.indexOf("_0") != -1) 
            {
                this._map["0"] as Object /* flash.geom.Rectangle */;
            }
            return this._map["1"] as Object /* flash.geom.Rectangle */;
        }

        public static get instance(): BubblesConfig
        {
            if (BubblesConfig._instance == null) 
            {
                BubblesConfig._instance = new BubblesConfig();
            }
            return BubblesConfig._instance;
        }

        /* internal */ /* var */_map: Map<any, any> /* flash.utils.Dictionary */;

        /* internal */ static /* var */_instance: BubblesConfig;
    }
